package org.linlinjava.litemall.wx.service;

import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.dao.LitemallAdMapper;
import org.linlinjava.litemall.db.domain.LitemallAd;
import org.linlinjava.litemall.db.domain.LitemallAdExample;
import org.linlinjava.litemall.db.service.LitemallAdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Administrator
 */
@Service
public class WxAdService {
    @Autowired
    private LitemallAdService adService;
    @Resource
    private LitemallAdMapper adMapper;

    public Object showBanner(Byte position) {
        LitemallAdExample example = new LitemallAdExample();
        example.or().andPositionEqualTo(position).andDeletedEqualTo(false);
        example.setOrderByClause("add_time desc");
        List<LitemallAd> litemallAds = adMapper.selectByExample(example);
        return ResponseUtil.okList(litemallAds);
    }
}
